|
![](/i/fill.gif) |
Bill DeWitt wrote:
>
> "Margus Ramst" <mar### [at] peak edu ee> wrote :
> >
> > #declare A=array[100]
> > #declare N=dimension_size(A,1); file://Auto get the number of elements
> > #declare C=0;
> > #while(C<N)
> > #declare A[C]=1;
> > #declare C=C+1;
> > #end
> >
>
> This is more or less what I was doing, I just wondered if there was
> anything else to know. I hadn't got the dimension_size thing though, Thanks!
I was messing with this a few months ago trying to sort irregular shaped
shingles on a roof. I resorted to storing and retrieving from an array. It
looks a bit like the example that Margus showed.
#declare Num = 20;
#declare MyArray = array[Num];
#declare i = 0;
#while (i < num)
#declare MyArray[i] = i;
#declare i = i + 1;
#end
this stores the current value of i into the array at each position (so
MyArray[5] = 5) to get them out, simply do something like the following
#declare i = 0;
#declare Sum = 0;
#while (i < num)
#declare Sum = Sum + MyArray[i];
#declare i = i + 1;
#end
--
Ken Tyler - 1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/
Post a reply to this message
|
![](/i/fill.gif) |